#include <REGX52.H>
#include "DELAY.h"
#include "KEY.h"
#include "NIXIE.h"
#include "MOTER.h"
#include "IR.h"

unsigned char Command,Speed;

void main()
{
	Moter_Init();
	IR_Init();
	while(1)
	{
		if(IR_GetDataFlag())
		{
			Command=IR_GetCommand();
			
			if(Command==IR_0)Speed=0;
			if(Command==IR_1)Speed=1;
			if(Command==IR_2)Speed=2;
			if(Command==IR_3)Speed=3;
			
			if(Speed==0)Moter_SetSpeed(0);//设置比较值，改变PWM占空比
			if(Speed==1)Moter_SetSpeed(50);
			if(Speed==2)Moter_SetSpeed(75);
			if(Speed==3)Moter_SetSpeed(100);
		}
		Nixie(1,Speed);
	}
}

